package com.yiwei.ydd.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.allen.library.SuperButton;
import com.yiwei.ydd.R;
import com.yiwei.ydd.adapter.PacketMoneyTypeAdapter;
import com.yiwei.ydd.adapter.PacketTypeAdapter;
import com.yiwei.ydd.api.Api;
import com.yiwei.ydd.api.bean.CouponListBean;
import com.yiwei.ydd.api.bean.PagesDetailBean;
import com.yiwei.ydd.api.bean.RechargeTermDetailBean;
import com.yiwei.ydd.api.model.RechargeTermModel;
import com.yiwei.ydd.api.model.ShareInfoModel;
import com.yiwei.ydd.base.BaseActivity;
import com.yiwei.ydd.constant.Const;
import com.yiwei.ydd.constant.UserInfoGlobal;
import com.yiwei.ydd.event.BuyVipUpSuccessEvent;
import com.yiwei.ydd.event.OilcardAddSuccess;
import com.yiwei.ydd.event.SelectCouponEvent;
import com.yiwei.ydd.util.Arith;
import com.yiwei.ydd.util.Dialog;
import com.yiwei.ydd.util.Network;
import com.yiwei.ydd.util.PacketStepDialog;
import com.yiwei.ydd.util.RxLifeUtil;
import com.yiwei.ydd.util.ShareUtil;
import com.yiwei.ydd.util.ToastUtil;
import com.yiwei.ydd.util.UI;
import com.yiwei.ydd.util.Util;
import com.yiwei.ydd.view.InputMoneyDialog;
import com.yiwei.ydd.view.OilChangeDialog;
import com.yiwei.ydd.view.PagesDetailDialog;
import com.yiwei.ydd.view.V19RelativeLayout;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * Created by xsooy-pc on 17-12-8.
 */

public class PacketRechargeActivity extends BaseActivity {
    @BindView(R.id.txt_title)
    TextView txtTitle;
    @BindView(R.id.list_type)
    RecyclerView listType;

    @BindView(R.id.layout_empty_oilcard)
    LinearLayout layoutEmptyOilcard;
    @BindView(R.id.layout_has_oilcard)
    RelativeLayout layoutHasOilcard;
    @BindView(R.id.txt_recharge_total)
    TextView txtRechargeTotal;
    @BindView(R.id.txt_actual_total)
    TextView txtActualTotal;
    @BindView(R.id.txt_recharge_tips)
    TextView txtRechargeTips;
    @BindView(R.id.txt_oil_type)
    TextView txtOilType;
    @BindView(R.id.txt_oil_card)
    TextView txtOilCard;
    @BindView(R.id.txt_term_detail)
    TextView txtTermDetail;
    @BindView(R.id.img_icon)
    ImageView imgIcon;
    @BindView(R.id.btn_back)
    ImageView btnBack;

    @BindView(R.id.layout_title)
    V19RelativeLayout layoutTitle;
    @BindView(R.id.btn_oil_change)
    TextView btnOilChange;
    @BindView(R.id.list_money)
    RecyclerView listMoney;
    @BindView(R.id.btn_tips)
    SuperButton btnTips;
    @BindView(R.id.btn_youhui_tips)
    ImageView btnYouhuiTips;
    @BindView(R.id.btn_coupon)
    LinearLayout btnCoupon;
    @BindView(R.id.btn_recharge_detail)
    LinearLayout btnRechargeDetail;
    @BindView(R.id.txt_bottom_one)
    TextView txtBottomOne;
    @BindView(R.id.txt_bottom_two)
    TextView txtBottomTwo;
    @BindView(R.id.btn_recharge)
    TextView btnRecharge;
    @BindView(R.id.txt_one_money_tips)
    TextView txtOneMoneyTips;
    @BindView(R.id.txt_coupon_tips)
    TextView txtCouponTips;
    @BindView(R.id.txt_right)
    TextView txtRight;
    @BindView(R.id.btn_notice_close)
    ImageView btnNoticeClose;
    @BindView(R.id.btn_notice)
    FrameLayout btnNotice;
    @BindView(R.id.view_step_one)
    View viewStepOne;
    @BindView(R.id.txt_tips)
    TextView txtTips;
    @BindView(R.id.btn_cal)
    TextView btnCal;
    @BindView(R.id.btn_cal_two)
    ImageView btnCalTwo;
    @BindView(R.id.btn_recharge_detail_one)
    TextView btnRechargeDetailOne;
    @BindView(R.id.view_three)
    View viewThree;
    @BindView(R.id.view_five)
    View viewFive;
    @BindView(R.id.layout_menu)
    LinearLayout layoutMenu;
    private Unbinder unbiner;
    private PacketTypeAdapter adapter;
    private OilChangeDialog oilChangeDialog;
    private String select_id;
    private String select_oilcard_id;
    private String select_actual_money;
    private String select_one_money;

    private boolean isCheckAll = false;
    private PacketMoneyTypeAdapter packetMoneyTypeAdapter;
    private double select_coupon_money;
    private String need_pay_money;
    private String coupon_id;
    private String select_periods;
    private String select_git;
    private String coupon_tips;
    private PagesDetailDialog pagesDetailDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recharge_packet);
        initWebViewBar();
        unbiner = ButterKnife.bind(this);
        init();
        EventBus.getDefault().register(this);
    }

    private void init() {
        pagesDetailDialog = new PagesDetailDialog(this).setKeyword(Const.PageDetailType.OILBAG);
        txtTitle.setText("套餐充值");
        packetMoneyTypeAdapter = new PacketMoneyTypeAdapter(this);
        packetMoneyTypeAdapter.setOnChooseListener(new PacketMoneyTypeAdapter.OnChooseListener() {
            @Override
            public void onClick(int poi, String money) {
                if (poi == (packetMoneyTypeAdapter.getItemCount() - 1)) {
                    select_one_money = "";
                    new InputMoneyDialog(PacketRechargeActivity.this).setDialogClickListener(new InputMoneyDialog.DialogDefaultClickListener() {
                        @Override
                        public void confirm(String money) {
                            packetMoneyTypeAdapter.getmSource().get(packetMoneyTypeAdapter.getItemCount() - 1).money = money;
                            packetMoneyTypeAdapter.notifyDataSetChanged();
                            select_one_money = money;
                            calculate(money, true);
                        }
                    }).show();
                    return;
                }
                select_one_money = money;
                calculate(money, true);
            }
        });
        listMoney.setLayoutManager(new GridLayoutManager(this, 3));
        listMoney.setAdapter(packetMoneyTypeAdapter);


//        txtRechargeTotal.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        oilChangeDialog = new OilChangeDialog(this);
        oilChangeDialog.setDialogClickListener(new OilChangeDialog.DialogDefaultClickListener() {
            @Override
            public void confirm(String id, String ctype, String card_number) {
                select_oilcard_id = id;
                if (ctype.equals("1")) {
                    txtOilType.setText("中国石化");
                    imgIcon.setImageResource(R.mipmap.img_shihua_two_map);
                } else if (ctype.equals("2")) {
                    txtOilType.setText("中国石油");
                    imgIcon.setImageResource(R.mipmap.img_shiyou_two_map);
                }
                txtOilCard.setText(card_number);
            }

            @Override
            public void cancel() {

            }
        });
//        listType.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
        adapter = new PacketTypeAdapter(this);
        adapter.setOnChooseListener(new PacketTypeAdapter.OnChooseListener() {
            @Override
            public void onClick(String id, String total_money, String git_money, String act_money, String period, String git) {
                coupon_id = "";
                txtCouponTips.setText(coupon_tips);
                select_coupon_money = 0;

                select_id = id;
                select_periods = period;
                select_git = git;
                txtRechargeTotal.setText("￥" + total_money);
                txtActualTotal.setText("￥" + act_money);
                txtTermDetail.setText(total_money + "元");
                need_pay_money = act_money;
                select_actual_money = act_money;
                UI.setTvHtml(txtRechargeTips, R.string.packet_tips, act_money, git_money, total_money);
            }

            @Override
            public void showLevelDialog(String level, String git) {
                String one = "";
                if (level.equals("2")) {
                    one = "金卡会员";
                } else if (level.equals("3")) {
                    one = "铂金会员";
                }
                Dialog.showDefaultDialog(PacketRechargeActivity.this, "", "只有升级到" + one + "才能享受最多" + git + "%的充值返现喔", "取消", "前往升级", false, new Dialog.DialogDefaultClickListener() {
                    @Override
                    public void confirm() {
                        Util.startActivity(PacketRechargeActivity.this, VipLevelUpTipsActivity.class);
                    }

                    @Override
                    public void cancel() {

                    }
                });
            }
        });
        listType.setNestedScrollingEnabled(false);
        listType.setAdapter(adapter);


        getRechargeTerm();
        getOilCardList();
        getCouponList(1);


    }

    private void showStepDialog() {
        PacketStepDialog.showStepOne(this);
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEvent(SelectCouponEvent event) {
        if (TextUtils.isEmpty(event.id)) {
            coupon_id = event.id;
            select_coupon_money = Double.valueOf(event.money);
            calculate(select_one_money, true);
        } else {
            coupon_id = event.id;
            select_coupon_money = Double.valueOf(event.money);
            txtCouponTips.setText("+" + event.money + "元");
            calculate(select_one_money, false);
        }

    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEvent(OilcardAddSuccess event) {
        getOilCardList();
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEvent(BuyVipUpSuccessEvent event) {
        finish();
    }

    private void calculate(String money, boolean isInit) {
        if (isInit) {
            coupon_id = "";
            txtCouponTips.setText(coupon_tips);
            select_coupon_money = 0;
        }

        txtOneMoneyTips.setText("注：首月" + money + "元，当天下单后2-48小时内到账");

        adapter.setOneMoney(Double.valueOf(money));

        if (!TextUtils.isEmpty(adapter.getSelect_git())) {
            String act_money = Arith.mul(Double.valueOf(adapter.getSelect_periods()), Double.valueOf(money)) + "";
            need_pay_money = act_money;
            String git_money = Arith.mul(Double.valueOf(act_money), Double.valueOf(adapter.getSelect_git()) * 0.01) + "";
            String total_money = (Arith.add(Double.valueOf(act_money), Double.valueOf(git_money)) + select_coupon_money) + "";
            UI.setTvHtml(txtRechargeTips, R.string.packet_tips, act_money, git_money, total_money);
            txtRechargeTotal.setText("￥" + total_money);
            txtActualTotal.setText("￥" + act_money);
            txtTermDetail.setText(total_money + "元");
            select_actual_money = act_money;
        }
    }


    public void getCouponList(int page) {
//        "可使用", "已使用", "已过期"
        //状态（0：过期，1:有效，2：已使用)
        if (!Network.checkNetwork(this)) {
            ToastUtil.show(this, "网络连接失败");
            return;
        }
        loadingDialog.show();
        CouponListBean bean = new CouponListBean();
        bean.page = page;
        bean.status = "1";
        Api.api_service.getCouponList(bean).compose(RxLifeUtil.checkOn(this)).
                doFinally(() -> {
                    try {
                        loadingDialog.dismiss();
                    } catch (NullPointerException e) {

                    }
                }).
                subscribe(result -> {
                    if (result.datas != null && result.datas.size() != 0) {
                        coupon_tips = result.datas.size() + "个加油包可使用";
                    } else {
                        coupon_tips = "暂无优惠券";

                    }
                    txtCouponTips.setText(coupon_tips);
                });
    }

    //    ===========================获取分期列表===========================
    public void getRechargeTerm() {
        if (!Network.checkNetwork(this)) {
            ToastUtil.show(this, "网络连接失败");
            return;
        }


        loadingDialog.show();
        Api.api_service.getRechargeTerm().compose(RxLifeUtil.checkOn(this)).
                doFinally(() -> {
                    try {
                        loadingDialog.dismiss();
                    } catch (NullPointerException e) {

                    }
                }).
                subscribe(result -> {

                    String one_money = "";
                    if (result.datas.money_lists != null && result.datas.money_lists.size() != 0) {
//                        RechargeTermModel.DatasBean.MoneyListsBean bean = new RechargeTermModel.DatasBean.MoneyListsBean();
//                        bean.id = "10";
//                        bean.money = "+ 自定义";
//                        bean.recommend = "0";
//                        result.datas.money_lists.add(bean);

                        for (int i = 0; i < result.datas.money_lists.size(); i++) {
                            RechargeTermModel.DatasBean.MoneyListsBean item = result.datas.money_lists.get(i);
                            if (item.recommend.equals("1")) {
                                item.isCheck = true;
                                select_one_money = item.money;
                                one_money = item.money;
                                calculate(item.money, true);
                            }
                        }
                        packetMoneyTypeAdapter.update(result.datas.money_lists);
                    }

                    if (result.datas.git != null && result.datas.git.size() != 0) {
                        for (int i = 0; i < result.datas.git.size(); i++) {
                            RechargeTermModel.DatasBean.GitBean item = result.datas.git.get(i);
                            if (item.recommend.equals("1") && Float.valueOf(item.inventory) > 0) {
                                item.isCheck = true;
                                String act_money = Arith.mul(Double.valueOf(item.periods), Double.valueOf(one_money)) + "";
                                String git_money = Arith.mul(Double.valueOf(act_money), Double.valueOf(item.git) * 0.01) + "";
                                String total_money = Arith.add(Double.valueOf(act_money), Double.valueOf(git_money)) + "";
                                coupon_id = "";
                                txtCouponTips.setText(coupon_tips);
                                select_coupon_money = 0;
                                select_actual_money = act_money;
                                select_id = item.id;
                                select_periods = item.periods;
                                select_git = item.git;
                                txtRechargeTotal.setText("￥" + total_money);
                                txtActualTotal.setText("￥" + act_money);
                                txtTermDetail.setText(total_money + "元");
                                need_pay_money = act_money;
                                UI.setTvHtml(txtRechargeTips, R.string.packet_tips, act_money, git_money, total_money);
                            }
                        }
                    }
                    adapter.update(result.datas.git);
                    if (TextUtils.isEmpty(result.datas.note)) {
                        btnTips.setVisibility(View.GONE);
                    } else {
                        btnTips.setVisibility(View.VISIBLE);
                        btnTips.setText(result.datas.note);
                    }
                    if (UserInfoGlobal.getPacketStepLead()) {
                    showStepDialog();
                        UserInfoGlobal.setPacketStepLead(false);
                    }
                });
    }
    //    ===========================获取分期列表===========================


    //    ===========================获取分期详情===========================
    public void getRechargeTermDetail(String coupon_money, String git, String money, String periods) {
        if (!Network.checkNetwork(this)) {
            ToastUtil.show(this, "网络连接失败");
            return;
        }


        loadingDialog.show();
        RechargeTermDetailBean bean = new RechargeTermDetailBean();
        bean.coupon_money = coupon_money;
        bean.git = git;
        bean.money = money;
        bean.periods = periods;
        Api.api_service.getRechargeTermDetail(bean).compose(RxLifeUtil.checkOn(this)).
                doFinally(() -> {
                    try {
                        loadingDialog.dismiss();
                    } catch (NullPointerException e) {

                    }
                }).
                subscribe(result -> {
                    Dialog.showRechargeDetailDialog(this, result.datas, new Dialog.DialogDefaultClickListener() {
                        @Override
                        public void confirm() {

                        }

                        @Override
                        public void cancel() {

                        }
                    });
                });
    }
    //    ===========================获取分期详情===========================


    //    ===========================获取油卡列表===========================
    public void getOilCardList() {
        if (!Network.checkNetwork(this)) {
            ToastUtil.show(this, "网络连接失败");
            return;
        }


        loadingDialog.show();
        Api.api_service.getOilcardList().compose(RxLifeUtil.checkOn(this)).
                doFinally(() -> {
                    try {
                        loadingDialog.dismiss();
                    } catch (NullPointerException e) {

                    }
                }).
                subscribe(result -> {
                    if (isCheckAll) {
                        oilChangeDialog.setData(result.datas);
                        oilChangeDialog.show();
                        isCheckAll = false;
                        return;
                    }
                    if (result.datas != null && result.datas.size() != 0) {
                        layoutHasOilcard.setVisibility(View.VISIBLE);
                        layoutEmptyOilcard.setVisibility(View.GONE);

                        if (result.datas.size() == 1) {
                            select_oilcard_id = result.datas.get(0).id;
                            if (result.datas.get(0).ctype.equals("1")) {
                                txtOilType.setText("中国石化");
                                imgIcon.setImageResource(R.mipmap.img_shihua_two_map);
                            } else if (result.datas.get(0).ctype.equals("2")) {
                                txtOilType.setText("中国石油");
                                imgIcon.setImageResource(R.mipmap.img_shiyou_two_map);
                            }
                            txtOilCard.setText(result.datas.get(0).card_number);
                        } else {

                            for (int i = 0; i < result.datas.size(); i++) {
                                if (result.datas.get(i).isdefault.equals("1")) {
                                    select_oilcard_id = result.datas.get(i).id;
                                    if (result.datas.get(i).ctype.equals("1")) {
                                        txtOilType.setText("中国石化");
                                        imgIcon.setImageResource(R.mipmap.img_shihua_two_map);
                                    } else if (result.datas.get(i).ctype.equals("2")) {
                                        txtOilType.setText("中国石油");
                                        imgIcon.setImageResource(R.mipmap.img_shiyou_two_map);
                                    }
                                    txtOilCard.setText(result.datas.get(i).card_number);

                                    return;
                                }
                            }

                            select_oilcard_id = result.datas.get(0).id;
                            if (result.datas.get(0).ctype.equals("1")) {
                                txtOilType.setText("中国石化");
                                imgIcon.setImageResource(R.mipmap.img_shihua_two_map);
                            } else if (result.datas.get(0).ctype.equals("2")) {
                                txtOilType.setText("中国石油");
                                imgIcon.setImageResource(R.mipmap.img_shiyou_two_map);
                            }
                            txtOilCard.setText(result.datas.get(0).card_number);

                        }
//                        select_oilcard_id = result.datas.get(0).id;
//                        if (result.datas.get(0).ctype.equals("1")) {
//                            txtOilType.setText("中国石化");
//                            imgIcon.setImageResource(R.mipmap.img_recharge_shihua);
//                        } else if (result.datas.get(0).ctype.equals("2")) {
//                            txtOilType.setText("中国石油");
//                            imgIcon.setImageResource(R.mipmap.img_recharge_shiyou);
//                        }
//                        txtOilCard.setText(result.datas.get(0).card_number);
                    } else {
                        layoutHasOilcard.setVisibility(View.GONE);
                        layoutEmptyOilcard.setVisibility(View.VISIBLE);
                    }

                });
    }

    //    ===========================获取油卡列表===========================
    public void getShareInfo() {
        if (!Network.checkNetwork(this)) {
            ToastUtil.show(this, "网络连接失败");
            return;
        }

        loadingDialog.show();
        Api.api_service.getShareInfo().compose(RxLifeUtil.checkOn(this)).
                doFinally(() -> {
                    try {
                        loadingDialog.dismiss();
                    } catch (NullPointerException e) {

                    }
                }).
                subscribe(result -> {
                    ShareInfoModel.DatasBean item = result.datas;
                    ShareUtil.share(this, item.desc, item.image, item.title, item.url);
                });
    }

    public void getPagesDetail() {
        if (!Network.checkNetwork(this)) {
            ToastUtil.show(this, "网络连接失败");
            return;
        }

        PagesDetailBean item = new PagesDetailBean();
        item.keyword = "recharge";
        loadingDialog.show();
        Api.api_service.getPagesDetail(item).compose(RxLifeUtil.checkOn(this)).
                doFinally(() -> {
                    try {
                        loadingDialog.dismiss();
                    } catch (NullPointerException e) {

                    }
                }).
                subscribe(result -> {
                    Intent intent1 = new Intent(this, WebViewActivity.class);
                    intent1.putExtra("content", result.datas.content);
                    intent1.putExtra("title", result.datas.title);
                    startActivity(intent1);
                });
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
        unbiner.unbind();
        unbiner = null;
    }

    @OnClick({R.id.btn_cal, R.id.btn_cal_two, R.id.btn_notice_close, R.id.btn_notice, R.id.layout_empty_oilcard, R.id.txt_right, R.id.btn_coupon, R.id.btn_oil_change, R.id.btn_tips, R.id.btn_back, R.id.btn_youhui_tips})
    public void onViewClick(View view) {
        if (UI.isFastClick()) {
            return;
        }
        switch (view.getId()) {
            case R.id.btn_notice_close:
                btnNotice.setVisibility(View.GONE);
                break;
            case R.id.btn_oil_change:
                isCheckAll = true;
                getOilCardList();
                break;
            case R.id.layout_empty_oilcard:
                Util.startActivity(this, OilCardAddActivity.class);
                break;

            case R.id.btn_tips:
                if(Util.getIsLogin(this))
                Util.startActivity(this, VipLevelUpTipsActivity.class);
                break;
            case R.id.btn_notice:
                getPagesDetail();
                break;
            case R.id.btn_back:
                finish();
                break;
            case R.id.btn_cal:
            case R.id.btn_cal_two:
                Intent intent2 = new Intent(this, WebViewActivity.class);
                intent2.putExtra("url", UserInfoGlobal.getCombo());
                intent2.putExtra("title", "计算方式");
                startActivity(intent2);
                break;
            case R.id.btn_coupon:
                Intent intent = new Intent(this, CouponSelectActivity.class);
                intent.putExtra("limit", need_pay_money);
                startActivity(intent);
                overridePendingTransition(R.anim.right_enter, R.anim.left_out);
                break;
            case R.id.btn_youhui_tips:
                pagesDetailDialog.show();
//                Dialog.showYouhuiTips(this);
                break;
            case R.id.txt_right:
//                Intent intent2 = new Intent(this, WebViewActivity.class);
//                intent2.putExtra("url", UserInfoGlobal.getQuestions());
//                intent2.putExtra("title", "常见问题");
//                startActivity(intent2);
                Util.startActivity(this, AllTipsActivity.class);
                break;
        }

    }


    @OnClick({R.id.btn_recharge_detail, R.id.btn_recharge_detail_one})
    public void onViewClicked1() {
        if (TextUtils.isEmpty(select_git) || TextUtils.isEmpty(select_periods)) {
            ToastUtil.makeText(this, "请选择套餐");
            return;
        }
        if (TextUtils.isEmpty(select_one_money)) {
            ToastUtil.makeText(this, "请选择充值金额");
            return;
        }
        getRechargeTermDetail(select_coupon_money + "", select_git, select_one_money, select_periods);
    }

    @OnClick(R.id.btn_recharge)
    public void onViewClicked2() {

        if (TextUtils.isEmpty(select_one_money)) {
            ToastUtil.makeText(this, "请选择充值金额");
            return;
        }
        if (TextUtils.isEmpty(select_id)) {
            ToastUtil.makeText(this, "请选择充值套餐");
            return;
        }

        if (TextUtils.isEmpty(select_oilcard_id)) {
            Dialog.showGuestrueDialog(this, "", "您目前还没有添加加油卡，支付成功后可以在“我的订单”里进行添加，您是否继续支付？", "取消", "继续支付", new Dialog.DialogDefaultClickListener() {
                @Override
                public void confirm() {
                    Intent intent = new Intent(PacketRechargeActivity.this, OilcardOrderPayMoneyActivity.class);
                    intent.putExtra("combo_id", select_id);
                    intent.putExtra("coupon_id", coupon_id);
                    intent.putExtra("money", select_one_money);
                    intent.putExtra("sale_money", select_actual_money);
                    intent.putExtra("oilcard_id", select_oilcard_id);
                    intent.putExtra("is_now_oil", false);
                    startActivity(intent);
                    overridePendingTransition(R.anim.right_enter, R.anim.left_out);
                }

                @Override
                public void cancel() {

                }
            });
            return;
        }

        Intent intent = new Intent(this, OilcardOrderPayMoneyActivity.class);
        intent.putExtra("combo_id", select_id);
        intent.putExtra("coupon_id", coupon_id);
        intent.putExtra("money", select_one_money);
        intent.putExtra("sale_money", select_actual_money);
        intent.putExtra("oilcard_id", select_oilcard_id);
        intent.putExtra("is_now_oil", false);
        startActivity(intent);
        overridePendingTransition(R.anim.right_enter, R.anim.left_out);

//        getRechargeTermOrder(select_id, "0", UI.toString(editMoney), select_oilcard_id, paymentType);
    }


}
